package com.itheima.exception;

import com.itheima.exception.BusinessException;
import com.itheima.pojo.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class PojectException {

    @ExceptionHandler(Exception.class)
    public R EE(Exception e){
        return new R(0,e.getMessage(),null,null);
    }

    @ExceptionHandler(BusinessException.class)
    public R exception(BusinessException be){
        return new R(0,be.getMessage(),null,null);
    }
}
